/*
2022-5-1
https://www.acwing.com/problem/content/4417/
*/
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    int a=-1e9,b=-1e9;
    int n,x;
    cin>>n;
    while(n--)
    {
        cin>>x;
        int p=a,q=b;
        if(x&1)
        {
            a=max(p,max(x,x+q));
            b=max(q,p+x);
        }
        else
        {
            a=max(p,p+x);
            b=max(x,max(q,x+q));
        }
    }
    cout<<a<<endl;
    return 0;
}
